//
//  DetailSectionHeaderView.swift
//  HengYouCai
//
//  Created by apple on 2018/6/21.
//  Copyright © 2018 lwj. All rights reserved.
//

import UIKit

class DetailSectionHeaderView: UIView {

    
    /// 底部的提示
    lazy var bottomLab: UILabel = {
        let temp  = UILabel()
        temp.textAlignment = .right
        temp.textColor = Normal_999Color
        temp.font = Font_WL(10)
//        temp.text = "*具体日期以实际日期为准"
        return temp
    }()
    
    /// 开始回款日期
    lazy var huikuanValueLab: UILabel = {
        let temp  = UILabel()
        temp.textAlignment = .right
        temp.textColor = Normal_ThemeColor
        temp.font = Font_WL(11)
        temp.text = ""
        return temp
    }()
    /// 开始回款
    lazy var huikuanLab: UILabel = {
        let temp  = UILabel()
        temp.textAlignment = .center
        temp.textColor = Normal_ThemeColor
        temp.font = Font_WL(11)
//        temp.text = "开始回款"
        return temp
    }()
    /// 开始计息日期
    lazy var jixiValueLab: UILabel = {
        let temp  = UILabel()
        temp.textAlignment = .center
        temp.textColor = Normal_ThemeColor
        temp.font = Font_WL(11)
        temp.text = ""
        return temp
    }()
    /// 开始计息
    lazy var jixiLab: UILabel = {
        let temp  = UILabel()
        temp.textAlignment = .center
        temp.textColor = Normal_ThemeColor
        temp.font = Font_WL(11)
//        temp.text = "开始计息"
        return temp
    }()
    /// 今日投资日期
    lazy var todayValueLab: UILabel = {
        let temp  = UILabel()
        temp.textAlignment = .left
        temp.textColor = Normal_ThemeColor
        temp.font = Font_WL(11)
        temp.text = ""
        return temp
    }()
    /// 今日投资
    lazy var todayLab: UILabel = {
        let temp  = UILabel()
        temp.textAlignment = .center
        temp.textColor = Normal_ThemeColor
        temp.font = Font_WL(11)
//        temp.text = "今日投资"
        return temp
    }()
    /// img
    lazy var img: UIImageView = {
        let temp  = UIImageView()
        temp.image = UIImage(named: "step")
        return temp
    }()
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        initUI()
    }
//    func initDate(_ beginDateLabel: String, _ investDateLabel: String, _ endDateLabel: String) {
//        todayValueLab.text = investDateLabel
//
//        jixiValueLab.text = beginDateLabel
//        huikuanValueLab.text = endDateLabel
//
//
//    }
    //更新内容
    func updateContent(model:DetailModel) {
        //                weakSelf?.sectionView.initDate((weakSelf?.detailModel?.beginDateLabel)!, (weakSelf?.detailModel?.investDateLabel)!, (weakSelf?.detailModel?.endDateLabel)!)
        
        todayValueLab.text = model.investDateLabel
        todayLab.text = model.investDateLabel2
        
        jixiValueLab.text = model.beginDateLabel
        jixiLab.text = model.beginDateLabel2
        
        huikuanValueLab.text = model.endDateLabel
        huikuanLab.text = model.endDateLabel2

        bottomLab.text = model.dateTips
        
    }
    func initUI(){
        let bgGrayView = UIView()
        bgGrayView.backgroundColor = Normal_458Color
        self.addSubview(bgGrayView)
        bgGrayView.snp.makeConstraints { (make) in
            make.edges.equalTo(UIEdgeInsetsMake(0, 0, 0, 0))
        }
        
        let bgWhiteView = UIView()
        bgWhiteView.backgroundColor = UIColor.white
        bgGrayView.addSubview(bgWhiteView)
        bgWhiteView.snp.makeConstraints { (make) in
            make.edges.equalTo(UIEdgeInsetsMake(7, 0, 7, 0))
        }
        
        bgWhiteView.addSubview(bottomLab)
        bottomLab.snp.makeConstraints { (make) in
            make.right.equalTo(-15)
            make.bottom.equalTo(-7)
        }
        
        bgWhiteView.addSubview(huikuanLab)
        huikuanLab.snp.makeConstraints { (make) in
            make.right.equalTo(-15)
            make.bottom.equalTo(bottomLab.snp.top).offset(-10)
        }
        
        bgWhiteView.addSubview(huikuanValueLab)
        huikuanValueLab.snp.makeConstraints { (make) in
            make.right.equalTo(-15)
            make.top.equalTo(14)
        }
        
        bgWhiteView.addSubview(todayLab)
        todayLab.snp.makeConstraints { (make) in
            make.left.equalTo(15)
            make.bottom.equalTo(huikuanLab.snp.bottom)
        }
        
        bgWhiteView.addSubview(todayValueLab)
        todayValueLab.snp.makeConstraints { (make) in
            make.left.equalTo(15)
            make.top.equalTo(huikuanValueLab.snp.top)
        }
        
        bgWhiteView.addSubview(jixiLab)
        jixiLab.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.bottom.equalTo(huikuanLab.snp.bottom)
        }
        
        bgWhiteView.addSubview(jixiValueLab)
        jixiValueLab.snp.makeConstraints { (make) in
            make.centerX.equalToSuperview()
            make.top.equalTo(huikuanValueLab.snp.top)
        }
        
        bgWhiteView.addSubview(img)
        img.snp.makeConstraints { (make) in
            make.left.equalTo(todayLab.snp.left)
            make.right.equalTo(huikuanLab.snp.right)
            make.bottom.equalTo(huikuanLab.snp.top).offset(-8)
        }
        
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
